<script>
/*
 * @Author: Your name
 * @Date:   2020-07-16 18:08:20
 * @Last Modified by:   Your name
 * @Last Modified time: 2020-07-21 18:25:25
 * logo: (...)
shopName: (...)
totleSell: (...)
baobeiCounts: (...)
score
 */
</script>
<template>
  <div id="shop-infos">
    <div class="shop-header">
      <img :src="shop.logo" alt="">
      <span class="shop-name">{{shop.shopName}}</span>
    </div>
    <div class="shop-center">
      <div class="shop-center-left">
        <div class="sell-counts">
          <div class="sell-counts-info">
            {{shop.totleSell | sellCountFiler}}
          </div>
          <div class="sell-count-text">
            总销量
          </div>
        </div>
        <div class="goods-counts">
          <div class="goods-counts-info">
            {{shop.baobeiCounts}}
          </div>
          <div class="goods-count-text">
            全部宝贝
          </div>
        </div>
      </div>
      <div class="shop-center-right">
        <table>
          <tr v-for="(item, index) in shop.score" :key="index">
            <td>{{item.name}}</td>
            <td class="score" :class="{'isBetter': item.isBetter}">{{  item.isDesc}}</td>
            <td class="better" :class="{'isBetterMore': item.isBetter}">{{  item.isBetter ? '高' : '低'}}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="shop-footer">
      <div class="shop-enter">进店逛逛</div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'DetailShopInfo',
  data(){
    return {
      
    }
  },
  props:{
    shop:{
      type: Object,
      default(){
        return {}
      }
    }
  },
  created(){
    //created()  mounted() 生命周期钩子中是获取不到prop的动态数据的
  },
  filters:{
    sellCountFiler: function(value){
      if(value < 10000){
        return value;
      }
      return (value/10000).toFixed(1) + '万';
    }
  }
}
</script>
<style lang="css">
  #shop-infos{
    width: 100%;
    padding: 20px 10px;
    background: #ffffff;
    border-bottom: 1px solid #cccccc;
  }
  #shop-infos .shop-header{
    display: flex;
    line-height: 60px;
    align-items: center;
  }
  #shop-infos .shop-header img{
    width: 55px;
    height: 55px;
    border-radius: 50%;
    vertical-align: center;
    border: 1px solid rgba(0,0,0,.1);
  }
  #shop-infos .shop-header .shop-name{
    vertical-align: center;
    margin-left: 10px;
    color: #333;
    font-size: 14px;
  }

  #shop-infos .shop-center{
    display: flex;
    font-size: 13px;
    color: #333;
    align-items: center;
  }
  #shop-infos .shop-center .shop-center-left{
    flex: 1;
    display: flex;
    text-align: center;
    justify-content: space-evenly;/* 让周围间隔均等的分开 */
  }
  #shop-infos .shop-center .shop-center-left .sell-counts-info{
    line-height: 20px;
  }
  #shop-infos .shop-center .shop-center-left .goods-counts-info{
    line-height: 20px;
  }
  #shop-infos .shop-center .shop-center-right{
    flex: 1;
    display: flex;
    text-align: center;
    justify-content: space-evenly;
    border-left: 1px solid #999;
  }
  .shop-center-right table td{
    padding: 2px 2px;
  }
  #shop-infos .shop-center .shop-center-right div{
    line-height: 20px;
  }
  .score{
    color: #5ea732;
  }
  .better{
    background: #5ea732;
    color: #ffffff;
    border-radius: 5px;
  }
  .isBetter{
    color: var(--color-high-text);
  }
  .isBetterMore{
    background: var(--color-high-text);
  }

  .shop-footer{
    text-align: center;
    margin-top: 20px;
  }
  .shop-footer .shop-enter{
    display: inline-block;
    font-size: 14px;
    background-color: #f2f5f8;
    width: 150px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border-radius: 10px;
  }
</style>